package com.jinlia.show.modules.system.controller.sys;

import com.alibaba.fastjson.JSONObject;
import com.jinlia.show.modules.base.art_design.entity.VueRoute;
import com.jinlia.show.modules.base.art_design.service.VueRouteMapperService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("vueRoute")
public class VueRouteController {

    @Autowired
    VueRouteMapperService vueRouteMapperService;

    @PostMapping("tree")
    public ResponseEntity listVueRoute(@RequestBody VueRoute menu) {
        List<VueRoute> treeVO = vueRouteMapperService.getTreeVO(menu);
        return ResponseEntity.ok(treeVO);
    }
    @PostMapping("addOrUpdate")
    public ResponseEntity addVueRoute(@RequestBody VueRoute menu) {
        vueRouteMapperService.addOrUpdate(menu);
        return ResponseEntity.ok(menu);
    }

    @PostMapping("del")
    public ResponseEntity delVueRoute(@RequestBody VueRoute menu) {
        vueRouteMapperService.delVueRoute(menu);
        return ResponseEntity.ok(menu);
    }
}
